package edu.mse.camel.client.chat.message;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.eclipse.swt.graphics.RGB;

import edu.mse.camel.client.session.team.ITeamMember;
import edu.mse.camel.client.session.team.TeamList;

public class Message implements IMessage {

	private RGB color;
	private String name;
	private String timeStamp;
	private String content;
	
	public Message(String content, String name, Date time){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");		
		this.content = content;
		this.timeStamp = sdf.format(time);

		if(name != null){
			ITeamMember aMember = TeamList.getInstance().getTeamMember(name);
			this.color = aMember.getColor();
			this.name = name;
		}
		else{
			this.name = "";
			this.color = new RGB(0,0,0);
		}
	}
	
	@Override
	public RGB getColor() {
		return color;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public String getTimeStamp() {
		return timeStamp;
	}

	@Override
	public String getContent() {
		return content;
	}
	
	@Override
	public void setColor(RGB color) {
		this.color = color;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public void setTimeStamp(String timeStamp) {
		this.timeStamp = timeStamp;
	}

	@Override
	public void setContent(String content) {
		this.content = content;		
	}
}
